using System;
using System.Collections.Generic;
using System.Text;

using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.Adapters;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.IO;
using System.Web.Configuration;
using System.Resources;
using Microsoft.SharePoint.Utilities;

namespace GetSharePointToValidate.Adapters
{
    public class GSPTV_PersonalActions : ControlAdapter
    {
        private const string REDIRECTURL = "/_layouts/SignOut.aspx";
        private const string LABELTEXT = "Log ud";
        protected override void RenderChildren(HtmlTextWriter writer)
        {
            
        }
        protected override void Render(HtmlTextWriter writer)
        {
            if (!this.Page.User.Identity.IsAuthenticated)
                base.Render(writer);
            else
            {
                HyperLink link = new HyperLink();
                link.Text = LABELTEXT;
                link.NavigateUrl = REDIRECTURL;
                link.RenderControl(writer);
            }
            //string s = string.Format("{0}App_GlobalResources{1}wss.resx", HttpContext.Current.Request.PhysicalApplicationPath, Path.DirectorySeparatorChar);
            //writer.Write(s);
        }

        void linkButton_Click(object sender, EventArgs e)
        {
            SPUtility.Redirect(REDIRECTURL, SPRedirectFlags.Default, HttpContext.Current);
        }
    }
}
